/**
 * aes加密方法========================================
 * @param data  明文
 * @returns  密文
 */
function AESEncrypt(data){
    //密钥
    var key =  "fg5tred4qaedasds";

    var block = 16;
    var dataBase64 = Base64.encode(data).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");

    var length = dataBase64.length % block;
    var pad = block - length;
    dataBase64 += new Array( pad + 1 ).join(  String.fromCharCode(pad) );

    key  = CryptoJS.enc.Hex.parse( CryptoJS.SHA256(key).toString() );
    var iv   = CryptoJS.enc.Latin1.parse('');

    return  CryptoJS.AES.encrypt(dataBase64, key,{iv:iv,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.ZeroPadding}).toString();
}
/**
 * ======================aes解密方法=================
 * @param data 密文
 * @returns  明文
 */
function AESDecrypt(data){
    //密钥
    var key =  "fg5tred4qaedasds";
    key  = CryptoJS.enc.Hex.parse( CryptoJS.SHA256( key ).toString() );
    var iv   = CryptoJS.enc.Latin1.parse('');
    var decrypted = CryptoJS.AES.decrypt(data, key, {iv:iv,padding:CryptoJS.pad.ZeroPadding});
    var dataBase64 =  decrypted.toString(CryptoJS.enc.Utf8);
    dataBase64 = dataBase64.replace(/-/g, "+").replace(/_/g, "/");
    var length = dataBase64.length;
    var slast = dataBase64.charAt(length-1).charCodeAt();
    return Base64.decode( dataBase64.substr(0, length-slast) );
}